package demo4_i;

public class Test {
    public static void func1(Animal animal){
        animal.eat();
    }

    public static void run(IRunning iRunning){
        iRunning.run();
    }

    public static void swim(ISwimming iSwimming){
        iSwimming.swim();
    }

    public static void fly(IFly iFly){
        iFly.fly();
    }

    public static void main1(String[] args) {
        func1(new Duck("唐老鸭", 7));
        func1(new Dog("旺财", 5));
        func1(new Fish("小丑鱼", 1));
    }

    public static void main2(String[] args) {
        run(new Duck("唐老鸭", 7));
    }


    interface IA{
        void testA();
    }
    interface IB{
        void testB();
    }
    interface IC extends IA,IB{
        void testC();
    }
    class D implements IC{
        public void testA(){}
        public void testB(){}
        public void testC(){}
    }

    public static void main3(String[] args) {
        Dog dog1 = new Dog("旺财", 5);
        Dog dog2 = new Dog("旺财", 5);
        System.out.println(dog1.equals(dog2));
        System.out.println(dog1 == dog2);
    }

    public static void main(String[] args) {
        Dog dog1 = new Dog("旺财", 5);
        Dog dog2 = new Dog("旺财", 5);
        System.out.println(dog1.hashCode());
        System.out.println(dog2.hashCode());
    }

}
